package bitcat.chuenyee.utils

import java.net.InetSocketAddress
import java.net.Socket

object PingUtil {
    fun isReachable(host: String, port: Int, timeoutMillis: Int = 3000): Boolean {
        return try {
            Socket().use { socket ->
                socket.connect(InetSocketAddress(host, port), timeoutMillis)
            }
            true
        } catch (e: Exception) {
            println("Nacos 服务不可达: ${e.message}")
            false
        }
    }
}